// TestCaseModel
// (c)2007 Mark Bulmahn. mBulmahn@web.de
// License: GPL 2.0
// Project: TestCaseGenerator. http://www.codeplex.com/TestCaseGenerator

using System;
using System.Collections.Generic;
using System.Text;

namespace TestCaseModel
{
    /// <summary>
    /// This is a single result rule. Result rule means an expression that
    /// determines what is an test object's result when a certain expression
    /// becomes true. The expression is a bool expression consisting of
    /// one or several test case parameters and their states.
    /// </summary>
    [Serializable]
    public class ResultRule
    {
        public enum ResultRuleType { ResultRule = 1, NullConditionRule = 2 }

        ResultRuleType ruleType = ResultRuleType.ResultRule;

        public ResultRuleType RuleType
        {
            get { return ruleType; }
            set { ruleType = value; }
        }

        string ruleName = "";

        public string RuleName
        {
            get { return ruleName; }
            set { ruleName = value; }
        }

        string ruleExpression = "";

        public string RuleExpression
        {
            get { return ruleExpression; }
            set { ruleExpression = value; }
        }

        string resultName = "";

        public string ResultName
        {
            get { return resultName; }
            set { resultName = value; }
        }

        bool obsoleteTestCase = false;

        public bool ObsoleteTestCase
        {
            get { return obsoleteTestCase; }
            set { obsoleteTestCase = value; }
        }

        public string ClearTextResult
        {
            get
            {
                string s = resultName + "->" + resultState.ToString();
                return s;
            }
        }

        bool resultState = false;

        public bool ResultState
        {
            get { return resultState; }
            set { resultState = value; }
        }

        public ResultRule()
        {
        }

        public ResultRule(ResultRule oldRule)
        {
            this.ruleType = oldRule.ruleType;
            this.ruleName = oldRule.ruleName;
            this.ruleExpression = oldRule.ruleExpression;
            this.resultName = oldRule.resultName;
            this.obsoleteTestCase = oldRule.obsoleteTestCase;
        }

        public ResultRule(string ruleExpression, string resultName, bool resultState)
        {
            this.ruleExpression = ruleExpression;
            this.resultName = resultName;
            this.resultState = resultState;
        }
       
    }
}
